package com.dong.es.entity.searchparam.query.match;

import co.elastic.clients.elasticsearch._types.query_dsl.BoolQuery;

/**
 * @description: Es 前缀匹配 查询
 * @author: 陈瑞东
 * @create: 2022-06-23 12:21
 */
public class EsPrefixQueryParam extends EsMatchQueryParam<String>{

    private static final long serialVersionUID = 7096998561619577055L;

    public EsPrefixQueryParam(String field, String value) {
        super(field, value);
    }

    @Override
    public void loadTo(BoolQuery.Builder target) {
        target.must(must -> must.prefix(prefix -> prefix.field(field).value(value)));
    }
}
